/**
 * 根据题意操作一遍即可。
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

using Real = long double;
using llt = long long;
using vi = vector<int>;
using vll = vector<llt>;
using pii = pair<int, int>;
using pll = pair<llt, llt>;
using i128 = __int128_t;
int N, R;

void work(){
    cin >> N >> R;
    for(int d,a,i=0;i<N;++i){
        cin >> d >> a;
        if(1 == d){
            if(1600 <= R and R <= 2799){
                R += a;
            }
        }else if(2 == d){
            if(1200 <= R and R <= 2399){
                R += a;
            }
        }else{
            assert(0);
        }
    }
    cout << R << endl;
    return;

}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    int nofkase = 1;
	// cin >> nofkase;
	while(nofkase--) work();
	return 0;
}